package com.fjxd.feign.clients;

import com.fjxd.feign.pojo.TicketStore;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author csw
 */
@FeignClient(value = "ticketStoreService")
public interface TicketStoreClient {
    /**
     * 通过机票id查询出所有关于该机票的所有机票库存
     *
     * @param ticketId 机票id
     * @return 返回一个机票库存数据的数组
     */
    @GetMapping("/ticketStore/getTicketStore/{ticketId}")
    List<TicketStore> getTicketStoreList(@PathVariable Integer ticketId);

    @PutMapping("/ticketStore/deduct/{ticketId}/{ticketType}")
    void ticketDeduct(@PathVariable String ticketId, @PathVariable Integer ticketType, @RequestParam(defaultValue = "1") Integer ticketCount);


    @PutMapping("/ticketStore/goBack/{aircraftTicketId}/{ticketCount}")
    void ticketGoBack(@PathVariable Integer aircraftTicketId, @PathVariable Integer ticketCount);
}
